import { VueHammer } from 'vue2-hammer'
import Audio from './audio'
import BackTop from './back-top'
import Battery from './battery'
import Book from './book'
import Button from './button'
import ButtonGroup from './button-group'
import CurvedText from './curved-text'
import CurvedText2 from './curved-text/index2.js'
import Drag from './drag'
import DragItem from './drag-item'
import DrawBoard from './drawboard'
import FileViewer from './file-viewer'
import ImageCompare from './image-compare'
import ImageEffect from './image-effect'
import ImageUpload from './image-upload'
import ImageViewer from './image-viewer'
import Loading from './loading'
import Modal from './modal'
import ScoreBar from './score-bar'
import Screenshot from './screenshot'
import ShareBar from './share-bar'
import StarBar from './star-bar'
import Tab from './tab'
import TabGroup from './tab-group'
import Toast from './toast'
import Tree from './tree'
import Video from './video'
import VideoRecord from './video-record'

const components = {
  Audio,
  BackTop,
  Battery,
  Book,
  Button,
  ButtonGroup,
  CurvedText,
  CurvedText2,
  Drag,
  DragItem,
  DrawBoard,
  FileViewer,
  ImageCompare,
  ImageEffect,
  ImageUpload,
  ImageViewer,
  Loading,
  Modal,
  ScoreBar,
  Screenshot,
  ShareBar,
  StarBar,
  Tab,
  TabGroup,
  Toast,
  Tree,
  Video,
  VideoRecord
}

const install = (Vue) => {
  if (install.installed) return
  Vue.use(VueHammer)
  Object.keys(components).forEach(k => {
    components[k].install(Vue)
  })
}

if (typeof window !== 'undefined' && window.Vue) {
  install(window.Vue)
}

export default {
  install,
  ...components
}
